package com.business.system.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.business.system.dao.BaseDataLibaryMapper;
import com.business.system.pojo.BaseDataLibary;
import com.business.system.service.IBaseDataLibaryService;
import com.utility.Page;

@Service
public class BaseDataLibaryServiceImpl implements IBaseDataLibaryService {

	@Autowired
	BaseDataLibaryMapper reserve_typeMapper;

	@Override
	public int insert(BaseDataLibary entity) throws RuntimeException {
		// TODO Auto-generated method stub
		return this.reserve_typeMapper.insert(entity);
	}

	@Override
	public int update(BaseDataLibary entity) throws RuntimeException {
		// TODO Auto-generated method stub
		return this.reserve_typeMapper.update(entity);
	}

	@Override
	public int delete(int id) throws RuntimeException {
		// TODO Auto-generated method stub
		return this.reserve_typeMapper.delete(id);
	}

	@Override
	public List<BaseDataLibary> selectAll(int type) throws RuntimeException {
		// TODO Auto-generated method stub
		return this.reserve_typeMapper.selectAll(type);
	}

	@Override
	public BaseDataLibary findById(int id) throws RuntimeException {
		// TODO Auto-generated method stub
		return this.reserve_typeMapper.findById(id);
	}

	@Override
	public Page<BaseDataLibary> findListPage(BaseDataLibary entity, int pageNo,
			int pageSize) throws RuntimeException {
		// TODO Auto-generated method stub
		Page<BaseDataLibary> page = new Page<BaseDataLibary>();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("desp", entity.getDesp());
		map.put("type", entity.getType());
		page.setParams(map);
		page.setPageNo(pageNo);
		page.setPageSize(pageSize);

		List<BaseDataLibary> list = this.reserve_typeMapper.findListPage(page);
		page.setResults(list);
		return page;
	}

}
